package com.qf.shopping.controll;

import com.qf.shopping.dto.memberDTO.MemberDTO;
import com.qf.shopping.dto.memberDTO.MemberPointDTO;
import com.qf.shopping.dto.memberDTO.MemberProfileDTO;
import com.qf.shopping.pojo.member.MemberPoint;
import com.qf.shopping.pojo.member.MemberProfile;
import com.qf.shopping.service.MemberService;
import com.sun.tools.internal.ws.processor.modeler.Modeler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import java.util.List;

@Controller
@RequestMapping("/member")
public class MemberControll {

    @Autowired
    private MemberService memberService=null;


    //获取所有列表
    @GetMapping("/members")
    public String getList(Model model){
        List<MemberDTO> lists =memberService.getMemberList();
        model.addAttribute("members",lists);
        return "/member/list";
    }

    //获取会员详情
    @GetMapping("/memberinfo/{id}")
    public String getOne(@PathVariable("id") Integer id,Model model){
        MemberProfileDTO m=memberService.getMerberProfile(id);
        model.addAttribute("memberprofile",m);
        return "/member/info";
    }

    //获取积分
    @RequestMapping("/memberpoint")
    public List<MemberPointDTO> getPoint(){
       List<MemberPointDTO> point= memberService.getMemberPointById(1);
        return null;
    }
}
